/**
 * Created by 凡 on 6/2/2016.
 */
var db = require('./db');

module.exports = {
    log: console.log.bind(console),
    CONF: require('../config.json'),
    db: db,
    _: require('lodash'),
    isContained: function (a, b) {
        if (!(a instanceof Array) || !(b instanceof Array)) return false;
        if (a.length < b.length) return false;
        var aStr = a.toString();
        for (var i = 0, len = b.length; i < len; i++) {
            if (aStr.indexOf(b[i]) == -1) return false;
        }
        return true;
    },
    makeArray:function(e,defaultValue){
        if(Array.isArray(e)){
            return e;
        }else if(e){
            return new Array(e);
        }else {
            if(defaultValue){
                return [defaultValue]
            }
            return [];
        }
    }
};